<template>
  <el-dialog
    :visible.sync="visible"
    title="详情"
    :close-on-click-modal="false"
    :close-on-press-escape="false"
    top="70px"
  >
    <el-form :model="dataForm" ref="dataForm" label-width="100px">
      <el-row :gutter="30">
        <el-col :span="24">
          <el-form-item label="商品名称:">
            <p class="txt">{{ dataForm.goodsName }}</p>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="人均价格:">
            <p class="txt">{{ dataForm.avePrice }}</p>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="座位数:">
            <p class="txt">{{ dataForm.seatNum }}</p>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="特色标签:">
            <p class="txt">{{ dataForm.featureLabels }}</p>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="活动区域:">
            <p class="txt">{{ dataForm.playArea }}</p>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="游玩时长:">
            <p class="txt">{{ dataForm.playLength }}</p>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="作业方式:">
            <p class="txt">{{ dataForm.workWay }}</p>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="上船地点:">
            <p class="txt">{{ dataForm.boardSite }}</p>
          </el-form-item>
        </el-col>
        <template v-if="dataForm.goodsType == 1">
          <el-col :span="8">
            <el-form-item label="数量:">
              <p class="txt">{{ dataForm.initNum }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="优惠价:">
              <p class="txt">{{ dataForm.discountPrice }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="开抢时间:">
              <p class="txt">{{ dataForm.robTime }}</p>
            </el-form-item>
          </el-col>
        </template>
        <template v-if="dataForm.goodsType == 3">
          <el-col :span="8">
            <el-form-item label="成团人数:">
              <p class="txt">{{ dataForm.clusteringNum }}</p>
            </el-form-item>
          </el-col>
             <el-col :span="8">
            <el-form-item label="剩余成团人数:">
              <p class="txt">{{ dataForm.residueClusteringNum }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="游玩日期:">
              <p class="txt">{{ dataForm.playDate }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="游玩时间:">
              <p class="txt">{{ dataForm.playTime }}</p>
            </el-form-item>
          </el-col>
        </template>
        <template v-if="dataForm.goodsType == 1">
          <el-col :span="8">
            <el-form-item label="游玩日期:">
              <p class="txt">{{ dataForm.playDate }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="游玩时间:">
              <p class="txt">{{ dataForm.playTime }}</p>
            </el-form-item>
          </el-col>
        </template>
        <!-- <el-col :span="24">
          <el-form-item label="封面:" v-if="dataForm.coverImg">
            <el-image
              :src="dataForm.coverImg"
              style="width: 140px; height: 140px"
            ></el-image>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="行程亮点:" v-if="dataForm.tripLights">
            <el-image
              :src="dataForm.tripLights"
              style="width: 140px; height: 140px"
            ></el-image>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="内容:">
            <p
              class="txt content"
              v-html="dataForm.buyGuide"
              style="margin-top: 8px"
            ></p>
          </el-form-item>
        </el-col> -->
      </el-row>
    </el-form>
  </el-dialog>
</template>

<script>
import template from "../devtools/template.vue";
export default {
  components: { template },
  data() {
    return {
      visible: false,
      dataForm: {
        id: "",
        comments: [],
        pics: [],
      },
    };
  },
  computed: {},
  methods: {
    init() {
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.getInfo();
        }
      });
    },
    // 获取信息
    getInfo() {
      this.$http
        .get("/scenic/goods/" + this.dataForm.id)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          this.dataForm = {
            ...this.dataForm,
            ...res.data,
          };
          // if (this.dataForm.pic) {
          //   this.dataForm.pics = this.dataForm.pic.splice(",");
          // }
        })
        .catch(() => {});
    },
  },
};
</script>

<style lang="scss" scoped>
.txt {
  line-height: 40px;
  height: auto;
  margin: 0;
  padding: 0;

  &.content {
    ::v-deep p {
      padding: 0;
      line-height: 24px;
      margin: 0 !important;
    }
    ::v-deep img {
      width: 100%;
    }

    img {
      width: 100%;
    }
  }
}
</style>
